package com.epam.javalab.giorgadze.task2.entity;

import java.util.ArrayList;
import java.util.List;

public class Sentence {
    private List<SentencePart> wordList = new ArrayList<SentencePart>();

    public void add(SentencePart element) {
        wordList.add(element);
    }

    public void deleteWord(int index) {
        wordList.remove(index);
    }

    public Sentence(List<SentencePart> wordList) {
        this.wordList = wordList;
    }

    public List<SentencePart> getWordList() {
        return wordList;
    }

    public void setWordList(List<SentencePart> wordList) {
        this.wordList = wordList;
    }

    public Sentence() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Sentence sentence = (Sentence) o;

        if (wordList != null ? !wordList.equals(sentence.wordList) : sentence.wordList != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return wordList != null ? wordList.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "\nSentence: " + wordList;
    }
}
